package com.ligotop.admin.system.controller;

import com.ligotop.core.configs.TestConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description:
 * @author: yudm
 * @date: 2017-09-15 14:27
 */
@Controller
public class IndexController {

    private Logger logger =  LoggerFactory.getLogger(this.getClass());

    @Autowired
    private TestConfig testConfig;


    @RequestMapping(path = {"/index","/"})
    public String index(){
        logger.debug("进入首页！");
        return "index";
    }


    @RequestMapping("/login")
    public String login(){
        logger.debug("进入登录页！");
        System.out.println("登录页1");
        return "login";
    }


    @ResponseBody
    @RequestMapping("/home")
    public Map home(){
        logger.info("测试日志系统，主页！");
        Map map = new HashMap();

        map.put("name","旅鸽科技有限公司");
        map.put("address","四川省成都市环球中心N3");
        map.put("tel","028-88998899");
        map.put("date",new Date());

        logger.info(testConfig.toString());

        return map;
    }

}
